<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/19
 * Time: 14:36
 */

namespace App\Http\Controllers;


use App\Jobs\TestTask;
use App\Jobs\yibuTask;
use Illuminate\Http\Request;
use \Hhxsv5\LaravelS\Swoole\Task\Task;
class TestController
{
    function ccc(Request $request){
        $data=$request->all();
//        $name=$data['name'];
        echo "开始:".date("Y-m-d H:i:s")."<br>";
        $X=["A","B","C"];
        foreach ($X as $k=>$S){
            $task=new TestTask($S);
            $success = Task::deliver($task);  // 异步投递任务，触发调用任务类的 handle 方法
        }
        echo "结束:".date("Y-m-d H:i:s")."<br>";
    }

    function yibu(Request $request){
        $data=$request->all();
        $task=new yibuTask($data);
        $success = Task::deliver($task);
        print_r($data);
//        echo $success;
    }
}